package com.finals.finalsscreen.phone;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.finals.finalsscreen.app.BaseApplication;

public class CallBroadcastReceiver extends BroadcastReceiver {

	BaseApplication mApplication;

	PhoneStateListen phoneStateListen;

	public CallBroadcastReceiver(BaseApplication mApplication, PhoneStateListen phoneStateListen) {
		this.mApplication = mApplication;
		this.phoneStateListen = phoneStateListen;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent == null) {
			return;
		}
		String action = intent.getAction();
		if (Intent.ACTION_NEW_OUTGOING_CALL.equals(action)) {
			phoneStateListen.setState(PhoneStateListen.CALL_STATE_OUTCALL);
		}
	}

}
